﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Satates.CMStates;
using Common;

namespace Operators.CMOperators
{
    public  class Move1CanibalLeft : iOperator
	{
		public override string ToString(){
	
		return "Move 1 Canibal Left";
	}
		
		public int getOperatorNumber()
		{
			return 1;
		}		
	    public Template execute(Template s)
        {
            CMState s2 = (CMState)s;
            s2.setLeftCanibals(s2.getLeftCanibals() + 1);
            s2.setRightCanibals(s2.getRightCanibals() - 1);
            s2.setBoat("left");
            return s2;
        }

        public bool available(Template t)
        {
            CMState s = (CMState)t;
            if (s.getBoat().Equals("right"))
                if (s.getRightCanibals() >= 1)
                    if ((s.getLeftCanibals() + 1 <= s.getLeftMissionaries()) || (s.getLeftMissionaries() == 0))
                        return true;
            return false;
        }
        public object Clone()
        {
            return this.MemberwiseClone();
        }
    }
}
